using Avalonia.Data.Converters;
using System;
using System.Globalization;

namespace IntegratedMeasuring.Utils;

public class ResultToTextConverter : IValueConverter
{
    public static readonly ResultToTextConverter Instance = new();

    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        if (value is int result)
        {
            return result switch
            {
                1 => "PASS",
                0 => "FAIL",
                2 => "NULL",
                _ => "UNKNOWN"
            };
        }
        
        return "UNKNOWN";
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
} 